package com.cherrish.demo.algorithm.sort;

/**
 * @author cherrish
 * @time 2019-01-17 16:03
 * @name ISort
 * @desc:
 */
public interface ISort {
    void sort(int[] arr, int len);

    static void swap(int[] arr, int x, int y){
        int temp = arr[x];
        arr[x] = arr[y];
        arr[y] = temp;
    }

    default void swap1(int[] arr, int x, int y){
        arr[x] = arr[x] + arr[y];
        arr[y] = arr[x] - arr[y];
        arr[x] = arr[x] - arr[y];
    }

    static void swap3(int[] arr, int x, int y){
        arr[x] = arr[x] ^ arr[y];
        arr[y] = arr[x] ^ arr[y];
        arr[x] = arr[x] ^ arr[y];
    }
}
